package com.briup.jd2511.web01.controller;

import com.briup.jd2511.web01.entity.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.Controller;

@RestController
public class HelloController{

    // baseURL=http://ip:port
    @RequestMapping("/hello")
    public String hello(){
        return "hello, web";
    }

    @RequestMapping("/apifox/user/getAll")
    public String helloJson(){

        return """
                [
                  {
                    "name": "张三",
                    "age": 20
                  },
                  {
                    "name": "李四",
                    "age": 22
                  }
                ]
                """;
    }

    @RequestMapping("/apifox/user/a")
    public User helloObject(){
        User user = new User();
        user.setName("张三");
        user.setAge(20);
        return user;
    }
}
